# -*- coding: utf-8 -*-

#产品信息页面
class productInfoPage():
    def __init__(self, driver):
        self.driver = driver
    ##########渠道和业务员信息###########
    #签单日期
    def signDate(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div[1]/span[3]/div[2]/input")
    #收单日期
    def collectionDate(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div[1]/span[5]/div[2]/input")
    #业务人员工号
    def chargePerson(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div[3]/div/div[3]/table/tbody/tr/td[1]/div/div/div[2]/span/div[2]/input")
    #################投保计划############
    #添加投保计划
    def plan(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[2]/div[1]/span[2]/i")
    #添加主险
    def addinsuredPerson(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[2]/div[2]/div/div/div[2]/div/div/div[3]/table/tbody/tr/td[1]/div/div/div[2]/span/div[2]/div/input")

    def addinsuredPersonConfirm(self,listdata):
        return self.driver.find_element_by_xpath("//*[text()='%s']" % listdata)
    #package
    def package(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[2]/div[2]/div/div/div[2]/div/div/div[3]/table/tbody/tr/td[2]/div/div/div[2]/span/div[2]/div/input")
    def packageConfirm(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]
    #选择按钮
    def control(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[2]/div[2]/div/div/div[3]/div/button[1]")
    #确定按钮
    def confirm(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[2]/div[2]/div/div/div[3]/div/button[2]/span")

    #险种计划
    def insuranceTypePlan(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[2]/div[2]/div/div/div[2]/div/div/div[3]/table/tbody/tr/td[3]/div/div/div[2]/span/div[2]/div/input")
    def insuranceTypePlan01(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[2]/div[2]/div/div/div[2]/div/div/div[3]/table/tbody/tr/td[2]/div/div/div[2]/span/div[2]/div/input")

    def insuranceTypePlanConfirm(self,listdata):
        return self.driver.find_elements_by_xpath("//*[contains(text(),'%s')]" % listdata)[-1]
    #主险保额
    def insuredAmount(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[2]/div[3]/div[1]/div[3]/table/tbody/tr[1]/td[3]/div/div/div[2]/span/div[2]/input")
    def payment(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[2]/div[3]/div[1]/div[3]/table/tbody/tr[1]/td[4]/div/div/div[2]/div/div/input")
    def paymentConfirm(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]
    def protect(self):
        return self.driver.find_element_by_xpath(("//*[@id='app']/div/div[3]/div[2]/div[3]/div[1]/div[3]/table/tbody/tr[1]/td[6]/div/div/div[2]/div/div[1]/input"))
    def protectConfirm(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]
    #附加险保额
    def additional(self,listdata):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[2]/div[3]/div[1]/div[3]/table/tbody/tr["+ str(listdata) +"]/td[3]/div/div/div[2]/span/div[2]/input")
    #附加险缴费年限
    def addpayment(self,listdata):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[2]/div[3]/div[1]/div[3]/table/tbody/tr["+ str(listdata) +"]/td[4]/div/div/div[2]/div/div/input")
    def addpaymentConfirm(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]

    #附加险保障期限
    def addprotect(self,listdata):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[2]/div[3]/div[1]/div[3]/table/tbody/tr["+ str(listdata) +"]/td[6]/div/div/div[2]/div/div/input")
    def addprotectConfirm(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]

    #付费方式
    def paymentType(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]
    #续期保费超过宽限期仍未支付
    def expayment(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]
    #年金领取方式
    def annuity(self):
        return self.driver.find_element_by_xpath("//*[text()='年金领取方式：']")
    def annuityConfirm(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[0]
    #保费计算
    def Premium(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[2]/div[3]/div[3]/div/div[1]/button/span")
    #法定受益人
    def Beneficiary(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]
    #指定受益人
    def BeneficiaryAppoint(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]
    #添加身故受益人
    def addBeneficiaryAppoint(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[3]/div[1]/span[2]/i")
    ########受益人信息######
    #姓名
    def beneficiaryName(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[1]/div/div/div[2]/span/div[2]/input")
    #性别
    def beneficiarySex(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[2]/div/div/div[2]/span/div[2]/div/input")
    def beneficiarySexConfirm(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]

    #证件类型
    def beneficiaryIDType(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[3]/div/div/div[2]/span/div[2]/div/input")
    def beneficiaryIDTypeCon(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]
    #证件号码
    def beneficiaryIDnum(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[4]/div/div/div[2]/span/div[2]/input")
    #出生日期
    def beneficiaryBirth(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[5]/div/div/div[2]/span/div[2]/input")
    #与被保人关系
    def beneficiaryRelation(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[6]/div/div/div[2]/span/div[2]/div/input")
    def beneficiaryRelationCon(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]
    #收益顺序
    def beneficiaryOrder(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[7]/div/div/div[2]/span/div[2]/div/input")
    def beneficiaryOrdercon(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]
    #收益比例
    def beneficiaryRatio(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[8]/div/div/div[2]/span/div[2]/input")
    #账户信息
    #添加账户信息
    def accountInfomation(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[4]/div[1]/span[2]/i")
    #持卡人姓名
    def accountName(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[4]/div[2]/div/div[3]/table/tbody/tr/td[1]/div/div/div[2]/span/div[2]/div/input")
    def accountNameCon(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]
    #卡用途类型
    def CardType(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[4]/div[2]/div/div[3]/table/tbody/tr/td[2]/div/div/div[2]/span/div[2]/div[2]/input")
    def CardTypeCon(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]
    #卡号
    def CardNum(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[4]/div[2]/div/div[3]/table/tbody/tr/td[3]/div/div/div[2]/span/div[2]/input")
    #开户行
    def CardBank(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[4]/div[2]/div/div[3]/table/tbody/tr/td[4]/div/div/div[2]/span/div[2]/div/input")
    def CardBankCon(self,listdata):
        return self.driver.find_elements_by_xpath("//*[text()='%s']" % listdata)[-1]
    #下一步
    def next(self):
        return self.driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div[5]/button[2]/span")
